import React from 'react'
import Router from 'next/router'
import Link from 'next/link'

class LoginOutMenu extends React.Component {
    constructor(props) {
        super(props)
    }

    handler = (type) =>
        Router.push({
            pathname: '/' + type
        })

    render() {
        return (
            <div>
                <Link href="/login" prefetch>
                    <a>登录</a>
                </Link>
                <a onClick={() => {
                    this.handler('register')
                }}>注册</a>
                <style jsx> {`
                    div {
                        flex: 0 0 180px;
                        text-align: right;
                    }
                    a {
                        display: inline-block;
                        margin: 0 15px;
                        color: #067df7;
                        text-decoration: none;
                        font-size: 13px;
                        cursor: pointer;
                    }
                `} </style>
            </div>)
    }
}

export default LoginOutMenu